package cn.edu.dgut.sai;

import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * @author Sai
 */
@WebServlet("/syncHello")
public class SyncHelloServlet extends HttpServlet {

    protected void doGet(HttpServletRequest request,
                         HttpServletResponse response) throws IOException {

        System.out.print("同步Servlet执行开始...");

        long start = System.currentTimeMillis();

        new RunningProcessThread().run();
        response.getWriter().write("同步Servlet示例，Hello World!");

        long end = System.currentTimeMillis();
        System.out.print("同步Servlet执行完成，耗时：" + (end - start) + "毫秒");
    }
}